<template>
  <div>
    <!-- 添加 -->
    <el-card class="add-card">
      <div>
        <el-icon>
          <Fold />
        </el-icon>
        <span>数据列表</span>
      </div>
      <div v-if="showadd">
        <el-button type="primary" @click="showDialog">添加</el-button>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import EventBus from '@/utils';
import { useRouter } from 'vue-router';

const router = useRouter()
const props = withDefaults(defineProps<{ showadd?: boolean }>(), { showadd: true })

function showDialog() {
  router.push('/pms/addProduct')
}

</script>

<style scoped>
.el-card.add-card {
  --el-card-padding: 0;
  height: 65px;
  margin: 10px 0;
  padding: 0 20px;
  box-sizing: border-box;
  width: 100%;
}

:deep(.el-card.add-card .el-card__body) {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.el-card.add-card .el-card__body div:first-child span {
  margin-left: 10px;
}
</style>